# @Version        : 1.0
# @Update Time    : 2024/11/28 23:45
# @File           : funcboost_record_schema.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from typing import Any, Optional

from src.core.base import BaseSchema
from pydantic import Field

from src.common.typing.schema_typing import DictStr, DatetimeStr


class FuncBoostRecordSchema(BaseSchema):
    host_process: str = Field(description="执行主机进程信息")
    queue_name: str = Field(description="队列名称")
    function: str = Field(description="函数名称")
    msg_dict: DictStr = Field(description="消息体")
    task_id: str = Field(description="任务id")
    process_id: int
    thread_id: int
    publish_time: float = Field(description="发布时间戳")
    publish_time_str: str = Field(description="发布时间")
    params: DictStr = Field(description="函数参数")
    params_str: DictStr = Field(description="函数参数")
    result: Optional[Any] = Field(description="函数返回值")
    run_times: int = Field(description="执行次数")
    exception: Optional[str] = Field(None, description="异常信息")
    time_start: float = Field(description="开始时间戳")
    time_cost: Optional[float] = Field(None, description="耗时")
    time_end: float = Field(description="结束时间戳")
    success: bool = Field(description="执行结果")
    run_status: str = Field(description="执行状态")
    total_thread: int = Field(description="并发数")
    rpc_result_expire_seconds: Optional[int] = Field(description="rpc结果过期时间")
    host_name: str = Field(description="主机名称")
    script_name: str = Field(description="脚本名称")
    script_name_long: str = Field(description="脚本绝对路径")
    insert_time_str: DatetimeStr = Field(description="插入时间")
    insert_minutes: str = Field(description="插入时间")
    insert_time: DatetimeStr = Field(description="插入时间")
    utime: DatetimeStr = Field(description="时区时间")
